package com.runoob.date;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Test1 {

    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");

        System.out.println(c.getTime());
        System.out.println(sdf.format(c.getTime()));
        c.add(Calendar.DATE,-1);
        System.out.println(c.getTime());
        System.out.println(sdf.format(c.getTime()));
    }
}
